--猎人的视线
local lierenshixian = fk.CreateSkill {
    name = "mcdh_lierenshixian",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

lierenshixian:addEffect(fk.TurnEnd,{
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(self) then return false end
        if target.id == player.id then return false end
        return player:getMark("mcdh_charge") >= 1 and player:getHandcardNum() < 4 and player:getHandcardNum() > 0
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        if room:askForSkillInvoke(player, self.name, nil, "#mcdh__lierenshixian-invoke1:" .. target.id) then
            lib.mcdh_charge(player, -1)
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local switch={
            [1]=function ()
                if not target:isNude() then
                    local card = room:askForCardChosen(player, target, "h", self.name)
                    room:obtainCard(player, card, false, fk.ReasonPrey)
                end
            end,
            [2]=function ()
                player:drawCards(1, self.name)
            end,
            [3]=function ()
                player:gainAnExtraTurn(true,lierenshixian.name,{Player.Play})
            end
        }
        local hs = player:getHandcardNum();
        local fSwitch=switch[hs];
        if fSwitch then fSwitch() end
    end
})

Fk:loadTranslationTable {
    ["mcdh_lierenshixian"] = "猎人的视线",
    [":mcdh_lierenshixian"] = "蓄力技(1)，其他角色的回合结束时，你可以执行第手牌数项：1.获得该角色的一张手牌；2.摸一张牌；3.你获得一个仅有出牌阶段的额外回合。",
    ["#mcdh__lierenshixian-invoke1"] = "是否对 %src 发动技能【猎人的视线】？"
}


return lierenshixian